package cn.edu.sjtu.process_management.constant;


public enum ComparisonOperator {
    GREATERTHAN("gt"),
    LESSTHAN("lt"),
    EQUAL("eq"),
    NOTEQUAL("ne"),
    GREATEREQUAL("ge"),
    LESSEQEUAL("le");

    private String value;

    ComparisonOperator(String value) {
        this.value = value;
    }

    public String getValue() {
        return this.value;
    }

    public static ComparisonOperator from(String value) {
        switch (value) {
            case "gt":
                return GREATERTHAN;
            case "lt":
                return LESSTHAN;
            case "eq":
                return EQUAL;
            case "ge":
                return GREATEREQUAL;
            case "le":
                return LESSEQEUAL;
            default:
                return NOTEQUAL;   // not equal by default
        }
    }
}